﻿#include "PolarCoordinateGraphSettingDialog.h"
#include "ui_PolarCoordinateGraphSettingDialog.h"

#include <QPushButton>
#include <QLineEdit>
#include <QComboBox>
#include <QCheckBox>
#include <QTableWidgetItem>
#include <QHeaderView>


#include "IdaWidgetHelper.h"
#include "PolarCoordinateSettingData.h"
#include "PolarCoordinateGraphWindow.h"

#include "BaseWidget/IdaDialogMsg.h"
#include "BaseWidget/DoubleSpinBox.h"
#include "BaseWidget/PostiveDoubleSpinBox.h"
#include "BaseWidget/EColorComboBox.h"
#include "BaseModule/GlobalHelper.h"
#include "StyleComboBox.h"
#include "BaseModule/IBaseSignal.h"
#include <iostream>

namespace pst
{
    PolarCoordinateGraphSettingDialog::PolarCoordinateGraphSettingDialog(QWidget* parent)
        : IdaDialogFrame(parent), ui(new Ui::PolarCoordinateGraphSettingDialog()), m_tableWidget_angleAxisDisplay(nullptr), m_tableWidget_angleAxisRange(nullptr), m_tableWidget_radiusAxisDisplay(nullptr), m_tableWidget_radiusAxisRange(nullptr), m_tableWidget_grid(nullptr), m_tableWidget_title(nullptr), m_tableWidget_legend(nullptr), m_tableWidget_dataProperty(nullptr)
    {
        ui->setupUi(this);

        initWidget();
    }

    PolarCoordinateGraphSettingDialog::~PolarCoordinateGraphSettingDialog()
    {
        delete ui;
        //if (m_PolarCoordinateGraphCenterSettingData)
        //{
        //    delete m_PolarCoordinateGraphCenterSettingData;
        //    m_PolarCoordinateGraphCenterSettingData = nullptr;
        //}
    }

    void PolarCoordinateGraphSettingDialog::initWidget()
    {
        setWindowSize(740, 400);
        setWindowTitle(QStringLiteral("显示设置"));

        // auto _button_apply = new QPushButton(QStringLiteral("应用"));
        // ui->buttonBox->addButton(_button_apply, QDialogButtonBox::YesRole);
        connect(ui->pushButton_reject, &QPushButton::clicked, this, &PolarCoordinateGraphSettingDialog::reject);
        connect(ui->pushButton_accept, &QPushButton::clicked, this, &PolarCoordinateGraphSettingDialog::accept);
        connect(ui->pushButton_apply, &QPushButton::clicked, this, &PolarCoordinateGraphSettingDialog::slot_apply);

        IdaWidgetHelperInstance->setMainButtonStyle(ui->pushButton_accept); // 将确定设置为主按钮

        m_tableWidget_angleAxisDisplay = initData_angleAxisDisplay();
        m_tableWidget_angleAxisRange = initData_angleAxisRange();
        m_tableWidget_radiusAxisDisplay = initData_radiusAxisDisplay();
        m_tableWidget_radiusAxisRange = initData_radiusAxisRange();
        m_tableWidget_grid = initData_grid();
        m_tableWidget_title = initData_title();
        m_tableWidget_legend = initData_legend();
        m_tableWidget_dataProperty = initData_dataProperty();

        IdaWidgetHelperInstance->setTableWidgetStyle(m_tableWidget_angleAxisDisplay);
        IdaWidgetHelperInstance->setTableWidgetStyle(m_tableWidget_angleAxisRange);
        IdaWidgetHelperInstance->setTableWidgetStyle(m_tableWidget_radiusAxisDisplay);
        IdaWidgetHelperInstance->setTableWidgetStyle(m_tableWidget_radiusAxisRange);
        IdaWidgetHelperInstance->setTableWidgetStyle(m_tableWidget_grid);
        IdaWidgetHelperInstance->setTableWidgetStyle(m_tableWidget_title);
        IdaWidgetHelperInstance->setTableWidgetStyle(m_tableWidget_legend);
        IdaWidgetHelperInstance->setTableWidgetStyle(m_tableWidget_dataProperty);

        ui->gridLayout_angleAxisDisplay->addWidget(m_tableWidget_angleAxisDisplay);
        ui->gridLayout_angleAxisRange->addWidget(m_tableWidget_angleAxisRange);
        ui->gridLayout_radiusAxisDisplay->addWidget(m_tableWidget_radiusAxisDisplay);
        ui->gridLayout_radiusAxisRange->addWidget(m_tableWidget_radiusAxisRange);
        ui->gridLayout_grid->addWidget(m_tableWidget_grid);
        ui->gridLayout_title->addWidget(m_tableWidget_title);
        ui->gridLayout_legend->addWidget(m_tableWidget_legend);
        ui->gridLayout_dataProperty->addWidget(m_tableWidget_dataProperty);

        //m_PolarCoordinateGraphCenterSettingData = new PolarCoordinateGraphCenterSettingData();

        // 将数据实例指针 传递给 临时数据类进行数据复制
        // m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->copyData(数据实例指针);
        return;
        updateUIData_angleAxisDisplay();
        updateUIData_angleAxisRange();
        updateUIData_radiusAxisDisplay();
        updateUIData_radiusAxisRange();
        updateUIData_grid();
        updateUIData_title();
        updateUIData_legend();
        updateUIData_dataProperty();
    }

    void PolarCoordinateGraphSettingDialog::initData(PolarCoordinateGraphCenterSettingData* polarCoordinateGraphCenterSettingData)
    {
        if (polarCoordinateGraphCenterSettingData != nullptr)
        {
            m_polarCoordinateGraphCenterSettingData = polarCoordinateGraphCenterSettingData;
            updateUIData_angleAxisDisplay();
            updateUIData_angleAxisRange();
            updateUIData_radiusAxisDisplay();
            updateUIData_radiusAxisRange();
            updateUIData_grid();
            updateUIData_title();
            updateUIData_legend();
            updateUIData_dataProperty();
        }
    }

    void PolarCoordinateGraphSettingDialog::ChangeCurrentWidget(int index)
    {
        if (index != 7)
        {
            ui->tabWidget->setTabEnabled(7, false);
        }
        else
        {
            ui->tabWidget->setTabEnabled(7, true);
        }
        ui->tabWidget->setCurrentIndex(index);
    }

    void PolarCoordinateGraphSettingDialog::setWindowUniversalID(int windowUniversalID)
    {
        m_windowUniversalID = windowUniversalID;
    }

    void PolarCoordinateGraphSettingDialog::setIndexOfGraph(int index)
    {
        m_indexOfGraph = index;
    }

    int PolarCoordinateGraphSettingDialog::getIndexOfGrapg() const
    {
        return m_indexOfGraph;
    }

    void PolarCoordinateGraphSettingDialog::reject()
    {

        IdaDialogFrame::reject();
    }

    void PolarCoordinateGraphSettingDialog::accept()
    {
        m_execSuccess = true;
        slot_apply();
        if (m_execSuccess)
        {
            IdaDialogFrame::accept();
        }
    }

    void PolarCoordinateGraphSettingDialog::slot_apply()
    {
        m_execSuccess = true;
        emit pyScriptIsRunning();
        m_pyCode.clear();
        m_pyCode.append(QString("polarcoordmainsetting = PostProcessing.PolarCoordinateGraphMainSetting()"));
        m_pyCode.append(QString("polarcoordmainsetting.setWindowId(%1)").arg(m_windowUniversalID));
        m_pyCode.append(QString("polarcoordmainsetting.setIndexOfGraph(%1)").arg(m_indexOfGraph));
        saveUIData_angleAxisDisplay();
        saveUIData_angleAxisRange();
        saveUIData_radiusAxisDisplay();
        saveUIData_radiusAxisRange();
        if (!m_execSuccess)
        {
            return;
        }
        saveUIData_grid();
        saveUIData_title();
        saveUIData_legend();
        saveUIData_dataProperty();
        m_pyCode.append(QString("polarcoordmainsetting.savePolarCoordinateGraphMainSettingData()"));
        emit IBaseSignalInstance->signal_execPYCode(m_pyCode, true, false);


        //------以下代码必须放在emit IBaseSignalInstance->signal_execPYCode(m_pyCode, true, false);之后执行--------
        auto _angleAxisDisplay = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getAngleAxisDisplay();
        QString angDisAxisColorStr = GlobalHelperInstance->convertIntListToQString(QList<int>{_angleAxisDisplay->m_axisColor.red(), _angleAxisDisplay->m_axisColor.green(), _angleAxisDisplay->m_axisColor.blue()});
        QString angDisAxisDigitColorStr = GlobalHelperInstance->convertIntListToQString(QList<int>{_angleAxisDisplay->m_axisDigitColor.red(), _angleAxisDisplay->m_axisDigitColor.green(), _angleAxisDisplay->m_axisDigitColor.blue()});

        auto _angleAxisRange = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getAngleAxisRange();

        auto _radiusAxisDisplay = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getRadiusAxisDisplay();
        QString radDisAxisColorStr = GlobalHelperInstance->convertIntListToQString(QList<int>{_radiusAxisDisplay->m_axisColor.red(), _radiusAxisDisplay->m_axisColor.green(), _radiusAxisDisplay->m_axisColor.blue()});
        QString radDisAxisDigitColorStr = GlobalHelperInstance->convertIntListToQString(QList<int>{_radiusAxisDisplay->m_axisDigitColor.red(), _radiusAxisDisplay->m_axisDigitColor.green(), _radiusAxisDisplay->m_axisDigitColor.blue()});

        auto _radiusAxisRange = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getRadiusAxisRange();

		

        auto _grid = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getGrid();
        QString gridMainGridLineColorStr = GlobalHelperInstance->convertIntListToQString(QList<int>{_grid->m_mainGridLineColor.red(), _grid->m_mainGridLineColor.green(), _grid->m_mainGridLineColor.blue()});

        auto _title = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getTitle();
        QString titleFontColorStr = GlobalHelperInstance->convertIntListToQString(QList<int>{_title->m_titleFontColor.red(), _title->m_titleFontColor.green(), _title->m_titleFontColor.blue()});

        auto _legend = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getLegend();
        QString legendFontColorStr = GlobalHelperInstance->convertIntListToQString(QList<int>{_legend->m_legendFontColor.red(), _legend->m_legendFontColor.green(), _legend->m_legendFontColor.blue()});
        QString legendLineColorStr = GlobalHelperInstance->convertIntListToQString(QList<int>{_legend->m_legendLineColor.red(), _legend->m_legendLineColor.green(), _legend->m_legendLineColor.blue()});

        auto _dataProperty = m_polarCoordinateGraphCenterSettingData->m_style2D_DataProperty;
        if (_dataProperty)
        {
            QString dataProDataLineColorStr = GlobalHelperInstance->convertIntListToQString(QList<int>{_dataProperty->m_dataLineColor.red(), _dataProperty->m_dataLineColor.green(), _dataProperty->m_dataLineColor.blue()});
            QString legendLineColorStr1 = GlobalHelperInstance->convertIntListToQString(QList<int>{_dataProperty->m_symbolColor.red(), _dataProperty->m_symbolColor.green(), _dataProperty->m_symbolColor.blue()});
        }

        //emit IBaseSignalInstance->signal_savePolarCoordinateGraphMainSettingData(
        //    m_windowId,
        //    m_indexOfGraph,
        //    angDisAxisColorStr,
        //    _angleAxisDisplay->m_axisThickness,
        //    _angleAxisDisplay->m_valuePrecision,
        //    angDisAxisDigitColorStr,
        //    _angleAxisDisplay->m_axisDigitSize,
        //    _angleAxisRange->m_isAutoStepSize,
        //    _angleAxisRange->m_customStepSize,
        //    radDisAxisColorStr,
        //    _radiusAxisDisplay->m_axisThickness,
        //    _radiusAxisDisplay->m_valuePrecision,
        //    radDisAxisDigitColorStr,
        //    _radiusAxisDisplay->m_axisDigitSize,
        //    _radiusAxisRange->m_isAutoRange,
        //    _radiusAxisRange->m_maxValue,
        //    _radiusAxisRange->m_minValue,
        //    _radiusAxisRange->m_isAutoStepSize,
        //    _radiusAxisRange->m_customStepSize,
        //    _grid->m_isMainGridLineDisplay,
        //    gridMainGridLineColorStr,
        //    _grid->m_mainGridLineStyle,
        //    _grid->m_mainGridLineThickness,
        //    _title->m_titleName,
        //    titleFontColorStr,
        //    _title->m_titleFontSize,
        //    legendFontColorStr,
        //    _legend->m_legendFontSize,
        //    legendLineColorStr,
        //    _legend->m_legendLineThickness,
        //    _dataProperty->m_resultDataName,
        //    dataProDataLineColorStr,
        //    _dataProperty->m_dataLineStyle,
        //    _dataProperty->m_dataLineThickness,
        //    _dataProperty->m_isDisplaySymbol,
        //    _dataProperty->m_symbolStyle,
        //    _dataProperty->m_symbolSize,
        //    legendLineColorStr1);

        //------以上代码必须放在emit IBaseSignalInstance->signal_execPYCode(m_pyCode, true, false);之后执行--------

        // 将临时数据类 传递给 数据实例指针进行数据复制
        // 数据实例指针->copyData(m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData);
        emit signal_sendData(m_windowUniversalID, m_curveInfoID);
    }

    QTableWidget* PolarCoordinateGraphSettingDialog::initData_angleAxisDisplay()
    {
        auto _tableWidget = new QTableWidget;
        _tableWidget->setColumnCount(2);
        _tableWidget->setRowCount(5);
        _tableWidget->setHorizontalHeaderLabels(QStringLiteral("名称,值").split(","));
        _tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);

        auto _fontSizeList = GlobalHelperInstance->getFontSizeList();
        auto _lineWidthList = GlobalHelperInstance->getLineWidthList();

        int _rowCount = -1;
        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("轴线颜色")));
        auto _comboBox_axisColor = new BaseWidget::EColorComboBox; // 轴线颜色
        _comboBox_axisColor->appendPredefinedColors();
        _tableWidget->setCellWidget(_rowCount, 1, _comboBox_axisColor);

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("轴线粗细")));
        auto _comboBox_axisThickness = new QComboBox; // 轴线粗细
        _tableWidget->setCellWidget(_rowCount, 1, _comboBox_axisThickness);
        for (int i = 0; i < _lineWidthList.size(); ++i)
        {
            _comboBox_axisThickness->addItem(_lineWidthList.at(i));
        }

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("数值精度")));
        auto _SpinBox_valuePrecision = new QSpinBox; // 数值精度
        _SpinBox_valuePrecision->setRange(0, 15);
        //_SpinBox_valuePrecision->setDecimals(0);
        //_SpinBox_valuePrecision->setSingleStep(1);
        //QLineEdit* lineEdit = _SpinBox_valuePrecision->findChild<QLineEdit*>();
        //if (lineEdit) {
        //    lineEdit->setValidator(new QIntValidator(0, 15, _SpinBox_valuePrecision));
        //}
        _tableWidget->setCellWidget(_rowCount, 1, _SpinBox_valuePrecision);

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("轴数字颜色")));
        auto _comboBox_axisDigitColor = new BaseWidget::EColorComboBox; // 轴数字颜色
        _comboBox_axisDigitColor->appendPredefinedColors();
        _tableWidget->setCellWidget(_rowCount, 1, _comboBox_axisDigitColor);

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("轴数字大小")));
        auto _comboBox_axisDigitSize = new QComboBox; // 轴数字大小
        _tableWidget->setCellWidget(_rowCount, 1, _comboBox_axisDigitSize);
        for (int i = 0; i < _fontSizeList.size(); ++i)
        {
            _comboBox_axisDigitSize->addItem(_fontSizeList.at(i));
        }

        // 设置第一列不可编辑
        for (int _row = 0; _row < _tableWidget->rowCount(); ++_row)
        {
            QTableWidgetItem* item = _tableWidget->item(_row, 0);
            item->setFlags(item->flags() & ~Qt::ItemIsEditable);
        }

        return _tableWidget;
    }

    QTableWidget* PolarCoordinateGraphSettingDialog::initData_angleAxisRange()
    {
        auto _tableWidget = new QTableWidget;
        _tableWidget->setColumnCount(2);
        _tableWidget->setRowCount(2);
        _tableWidget->setHorizontalHeaderLabels(QStringLiteral("名称,值").split(","));
        _tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);

        int _rowCount = -1;
        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("自动步长")));
        auto _checkBox_isAutoStepSize = new QCheckBox(); // 自动步长
        _tableWidget->setCellWidget(_rowCount, 1, _checkBox_isAutoStepSize);

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("自定义步长")));
        auto _doubleSpinBox_customStepSize = new BaseWidget::PostiveDoubleSpinBox(); // 自定义步长
        _doubleSpinBox_customStepSize->setRange(5, 180);
        _doubleSpinBox_customStepSize->setDecimals(15);
        _tableWidget->setCellWidget(_rowCount, 1, _doubleSpinBox_customStepSize);
        /*
         * checkbox 控制禁用状态
         */
        connect(_checkBox_isAutoStepSize, &QCheckBox::toggled, this,
                [=](bool checked)
                {
                    _doubleSpinBox_customStepSize->setEnabled(!checked);
                });
        // 设置第一列不可编辑
        for (int _row = 0; _row < _tableWidget->rowCount(); ++_row)
        {
            QTableWidgetItem* item = _tableWidget->item(_row, 0);
            item->setFlags(item->flags() & ~Qt::ItemIsEditable);
        }

        return _tableWidget;
    }

    QTableWidget* PolarCoordinateGraphSettingDialog::initData_radiusAxisDisplay()
    {

        auto _tableWidget = initData_angleAxisDisplay();

        return _tableWidget;
    }

    QTableWidget* PolarCoordinateGraphSettingDialog::initData_radiusAxisRange()
    {
        auto _tableWidget = new QTableWidget;
        _tableWidget->setColumnCount(2);
        _tableWidget->setRowCount(5);
        _tableWidget->setHorizontalHeaderLabels(QStringLiteral("名称,值").split(","));
        _tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);

        int _rowCount = -1;
        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("自动范围")));
        auto _checkBox_isAutoRange = new QCheckBox(); // 自动范围
        _tableWidget->setCellWidget(_rowCount, 1, _checkBox_isAutoRange);

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("最大值")));
        auto _doubleSpinBox_maxValue = new BaseWidget::DoubleSpinBox(); // 最大值
        _doubleSpinBox_maxValue->setRange(-1e15, 1e15);
        _doubleSpinBox_maxValue->setDecimals(15);
        _tableWidget->setCellWidget(_rowCount, 1, _doubleSpinBox_maxValue);

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("最小值")));
        auto _doubleSpinBox_minValue = new BaseWidget::DoubleSpinBox(); // 最小值
        _doubleSpinBox_minValue->setRange(-1e15, 1e15);
        _doubleSpinBox_minValue->setDecimals(15);
        _tableWidget->setCellWidget(_rowCount, 1, _doubleSpinBox_minValue);

        /*
         * checkbox 控制禁用状态
         */
        connect(_checkBox_isAutoRange, &QCheckBox::toggled, this,
                [=](bool checked)
                {
                    _doubleSpinBox_maxValue->setEnabled(!checked);
                    _doubleSpinBox_minValue->setEnabled(!checked);
                });

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("自动步长")));
        auto _checkBox_isAutoStepSize = new QCheckBox(); // 自动步长
        _tableWidget->setCellWidget(_rowCount, 1, _checkBox_isAutoStepSize);

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("自定义步长")));
        auto _doubleSpinBox_customStepSize = new BaseWidget::PostiveDoubleSpinBox(); // 自定义步长
        _doubleSpinBox_customStepSize->setDecimals(15);
        _doubleSpinBox_customStepSize->setMinimum(1e-15);
        _doubleSpinBox_customStepSize->setMaximum(1e15);
        _tableWidget->setCellWidget(_rowCount, 1, _doubleSpinBox_customStepSize);

        /*
         * checkbox 控制禁用状态
         */
        connect(_checkBox_isAutoStepSize, &QCheckBox::toggled, this,
                [=](bool checked)
                {
                    _doubleSpinBox_customStepSize->setEnabled(!checked);
                });

        // 设置第一列不可编辑
        for (int _row = 0; _row < _tableWidget->rowCount(); ++_row)
        {
            QTableWidgetItem* item = _tableWidget->item(_row, 0);
            item->setFlags(item->flags() & ~Qt::ItemIsEditable);
        }

        return _tableWidget;
    }

    QTableWidget* PolarCoordinateGraphSettingDialog::initData_grid()
    {
        auto _tableWidget = new QTableWidget();
        _tableWidget->setColumnCount(2);
        _tableWidget->setRowCount(4);
        _tableWidget->setHorizontalHeaderLabels(QStringLiteral("名称,值").split(","));
        _tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);

        auto _lineWidthList = GlobalHelperInstance->getLineWidthList();

        int _rowCount = -1;
        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("圆网格线显示")));
        auto _checkBox_isMainGridLineDisplay = new QCheckBox(); // 自动范围
        _tableWidget->setCellWidget(_rowCount, 1, _checkBox_isMainGridLineDisplay);

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("圆网格线颜色")));
        auto _comboBox_mainGridLineColor = new BaseWidget::EColorComboBox; // 圆网格线颜色
        _comboBox_mainGridLineColor->appendPredefinedColors();
        _tableWidget->setCellWidget(_rowCount, 1, _comboBox_mainGridLineColor);

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("圆网格线样式")));
        auto _comboBox_mainGridLineStyle = new LineStyleComboBox; // 圆网格线样式
        _tableWidget->setCellWidget(_rowCount, 1, _comboBox_mainGridLineStyle);

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("圆网格线粗细")));
        auto _comboBox_mainGridLineThickness = new QComboBox(); // 圆网格线粗细
        _tableWidget->setCellWidget(_rowCount, 1, _comboBox_mainGridLineThickness);
        for (int i = 0; i < _lineWidthList.size(); ++i)
        {
            _comboBox_mainGridLineThickness->addItem(_lineWidthList.at(i));
        }

        // 设置第一列不可编辑
        for (int _row = 0; _row < _tableWidget->rowCount(); ++_row)
        {
            QTableWidgetItem* item = _tableWidget->item(_row, 0);
            item->setFlags(item->flags() & ~Qt::ItemIsEditable);
        }

        return _tableWidget;
    }

    QTableWidget* PolarCoordinateGraphSettingDialog::initData_title()
    {
        auto _tableWidget = new QTableWidget();
        _tableWidget->setColumnCount(2);
        _tableWidget->setRowCount(3);
        _tableWidget->setHorizontalHeaderLabels(QStringLiteral("名称,值").split(","));
        _tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);

        int _rowCount = -1;
        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("标题名")));
        auto _lineEdit_title = new QLineEdit; // 标题名
        _tableWidget->setCellWidget(_rowCount, 1, _lineEdit_title);

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("标题字体颜色")));
        auto _comboBox_titleFontColor = new BaseWidget::EColorComboBox; // 标题字体颜色
        _comboBox_titleFontColor->appendPredefinedColors();
        _tableWidget->setCellWidget(_rowCount, 1, _comboBox_titleFontColor);

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("标题字体大小")));
        auto _comboBox_titleFontSize = new QComboBox; // 标题字体大小
        _tableWidget->setCellWidget(_rowCount, 1, _comboBox_titleFontSize);
        for (int i = 1; i <= 50; ++i)
        {
            _comboBox_titleFontSize->addItem(QString::number(i));
        }

        // 设置第一列不可编辑
        for (int _row = 0; _row < _tableWidget->rowCount(); ++_row)
        {
            QTableWidgetItem* item = _tableWidget->item(_row, 0);
            item->setFlags(item->flags() & ~Qt::ItemIsEditable);
        }

        return _tableWidget;
    }

    QTableWidget* PolarCoordinateGraphSettingDialog::initData_legend()
    {
        auto _tableWidget = new QTableWidget();
        _tableWidget->setColumnCount(2);
        _tableWidget->setRowCount(4);
        _tableWidget->setHorizontalHeaderLabels(QStringLiteral("名称,值").split(","));
        _tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);

        int _rowCount = -1;
        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("图例字体颜色")));
        auto _comboBox_legendFontColor = new BaseWidget::EColorComboBox; // 图例字体颜色
        _comboBox_legendFontColor->appendPredefinedColors();
        _tableWidget->setCellWidget(_rowCount, 1, _comboBox_legendFontColor);

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("图例字体大小")));
        auto _comboBox_legendFontSize = new QComboBox; // 图例字体大小
        _tableWidget->setCellWidget(_rowCount, 1, _comboBox_legendFontSize);
        for (int i = 1; i <= 50; ++i)
        {
            _comboBox_legendFontSize->addItem(QString::number(i));
        }

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("图例框线颜色")));
        auto _comboBox_legendLineColor = new BaseWidget::EColorComboBox; // 图例框线颜色
        _comboBox_legendLineColor->appendPredefinedColors();
        _tableWidget->setCellWidget(_rowCount, 1, _comboBox_legendLineColor);

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("图例框线粗细")));
        auto _comboBox_legendLineThickness = new QComboBox; // 图例框线粗细
        _tableWidget->setCellWidget(_rowCount, 1, _comboBox_legendLineThickness);
        for (int i = 1; i <= 50; ++i)
        {
            _comboBox_legendLineThickness->addItem(QString::number(i));
        }

        // 设置第一列不可编辑
        for (int _row = 0; _row < _tableWidget->rowCount(); ++_row)
        {
            QTableWidgetItem* item = _tableWidget->item(_row, 0);
            item->setFlags(item->flags() & ~Qt::ItemIsEditable);
        }

        return _tableWidget;
    }

    QTableWidget* PolarCoordinateGraphSettingDialog::initData_dataProperty()
    {
        auto _tableWidget = new QTableWidget();
        _tableWidget->setColumnCount(2);
        _tableWidget->setRowCount(8);
        _tableWidget->setHorizontalHeaderLabels(QStringLiteral("名称,值").split(","));
        _tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);

        auto _lineWidthList = GlobalHelperInstance->getLineWidthList();

        int _rowCount = -1;
        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("结果数据名称")));
        auto _lineEdit_resultDataName = new QLineEdit; // 结果数据名称
        _tableWidget->setCellWidget(_rowCount, 1, _lineEdit_resultDataName);

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("数据线颜色")));
        auto _comboBox_dataLineColor = new BaseWidget::EColorComboBox; // 数据线颜色
        _comboBox_dataLineColor->appendPredefinedColors();
        _tableWidget->setCellWidget(_rowCount, 1, _comboBox_dataLineColor);

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("数据线样式")));
        auto _comboBox_dataLineStyle = new LineStyleComboBox; // 数据线样式
        _tableWidget->setCellWidget(_rowCount, 1, _comboBox_dataLineStyle);

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("数据线粗细")));
        auto _comboBox_dataLineThickness = new QComboBox; // 数据线粗细
        _tableWidget->setCellWidget(_rowCount, 1, _comboBox_dataLineThickness);
        for (int i = 0; i < _lineWidthList.size(); ++i)
        {
            _comboBox_dataLineThickness->addItem(_lineWidthList.at(i));
        }

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("是否显示符号")));
        auto _checkBox_isDisplaySymbol = new QCheckBox(); // 是否显示符号
        _tableWidget->setCellWidget(_rowCount, 1, _checkBox_isDisplaySymbol);

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("符号样式")));
        auto _comboBox_symbolStyle = new ScatterStyleComboBox; // 符号样式
        _tableWidget->setCellWidget(_rowCount, 1, _comboBox_symbolStyle);

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("符号大小")));
        auto _comboBox_symbolSize = new QComboBox; // 符号大小
        _tableWidget->setCellWidget(_rowCount, 1, _comboBox_symbolSize);
        for (int i = 0; i < _lineWidthList.size() - 4; ++i)
        {
            _comboBox_symbolSize->addItem(_lineWidthList.at(i));
        }

        _tableWidget->setItem(++_rowCount, 0, new QTableWidgetItem(QStringLiteral("符号颜色")));
        auto _comboBox_symbolColor = new BaseWidget::EColorComboBox; // 符号颜色
        _comboBox_symbolColor->appendPredefinedColors();
        _tableWidget->setCellWidget(_rowCount, 1, _comboBox_symbolColor);

        // 设置第一列不可编辑
        for (int _row = 0; _row < _tableWidget->rowCount(); ++_row)
        {
            QTableWidgetItem* item = _tableWidget->item(_row, 0);
            item->setFlags(item->flags() & ~Qt::ItemIsEditable);
        }

        return _tableWidget;
    }

    void PolarCoordinateGraphSettingDialog::saveUIData_angleAxisDisplay()
    {
        auto _tableWidget = m_tableWidget_angleAxisDisplay;
        int _rowCount = -1;
        auto _comboBox_axisColor = (BaseWidget::EColorComboBox*)_tableWidget->cellWidget(++_rowCount, 1);          // 轴线颜色
        auto _comboBox_axisThickness = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);                       // 轴线粗细
        auto _SpinBox_valuePrecision = (QSpinBox*)_tableWidget->cellWidget(++_rowCount, 1); // 数值精度
        auto _comboBox_axisDigitColor = (BaseWidget::EColorComboBox*)_tableWidget->cellWidget(++_rowCount, 1);     // 轴数字颜色
        auto _comboBox_axisDigitSize = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);                       // 轴数字大小

        QColor angDisAxisColor = _comboBox_axisColor->currentColor();
        QString angDisAxisColorStr = GlobalHelperInstance->convertIntListToQString(QList<int>{angDisAxisColor.red(), angDisAxisColor.green(), angDisAxisColor.blue()});
        int angDisAxisThickness = _comboBox_axisThickness->currentText().toInt();
        auto angDisValuePrecision = _SpinBox_valuePrecision->value();
        QColor angDisAxisDigitColor = _comboBox_axisDigitColor->currentColor();
        QString angDisAxisDigitColorStr = GlobalHelperInstance->convertIntListToQString(QList<int>{angDisAxisDigitColor.red(), angDisAxisDigitColor.green(), angDisAxisDigitColor.blue()});

        int angDisAxisDigitSize = _comboBox_axisDigitSize->currentText().toInt();
        auto _angleAxisDisplay = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getAngleAxisDisplay();
        _angleAxisDisplay->m_axisColor = angDisAxisColor;
        _angleAxisDisplay->m_axisThickness = angDisAxisThickness;
        _angleAxisDisplay->m_valuePrecision = angDisValuePrecision;
        _angleAxisDisplay->m_axisDigitColor = angDisAxisDigitColor;
        _angleAxisDisplay->m_axisDigitSize = angDisAxisDigitSize;

        m_pyCode.append(QString("polarcoordmainsetting.saveUIData_angleAxisDisplay('%1',%2,%3,'%4',%5)")
                            .arg(angDisAxisColorStr)
                            .arg(angDisAxisThickness)
                            .arg(angDisValuePrecision)
                            .arg(angDisAxisDigitColorStr)
                            .arg(angDisAxisDigitSize));
    }

    void PolarCoordinateGraphSettingDialog::saveUIData_angleAxisRange()
    {
        auto _tableWidget = m_tableWidget_angleAxisRange;
        int _rowCount = -1;
        auto _checkBox_isAutoStepSize = (QCheckBox*)_tableWidget->cellWidget(++_rowCount, 1);                      // 自动步长
        auto _doubleSpinBox_customStepSize = (BaseWidget::DoubleSpinBox*)_tableWidget->cellWidget(++_rowCount, 1); // 自定义步长

        bool angRangIsAutoStepSize = _checkBox_isAutoStepSize->isChecked();
        auto angRangCustomStepSize = _doubleSpinBox_customStepSize->value();

        auto _angleAxisRange = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getAngleAxisRange();
        _angleAxisRange->m_isAutoStepSize = angRangIsAutoStepSize;
        _angleAxisRange->m_customStepSize = angRangCustomStepSize;

        m_pyCode.append(QString("polarcoordmainsetting.saveUIData_angleAxisRange(%1,%2)")
                            .arg(angRangIsAutoStepSize)
                            .arg(angRangCustomStepSize));
    }

    void PolarCoordinateGraphSettingDialog::saveUIData_radiusAxisDisplay()
    {
        auto _tableWidget = m_tableWidget_radiusAxisDisplay;
        int _rowCount = -1;
        auto _comboBox_axisColor = (BaseWidget::EColorComboBox*)_tableWidget->cellWidget(++_rowCount, 1);          // 轴线颜色
        auto _comboBox_axisThickness = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);                       // 轴线粗细
        auto _SpinBox_valuePrecision = (QSpinBox*)_tableWidget->cellWidget(++_rowCount, 1); // 数值精度
        auto _comboBox_axisDigitColor = (BaseWidget::EColorComboBox*)_tableWidget->cellWidget(++_rowCount, 1);     // 轴数字颜色
        auto _comboBox_axisDigitSize = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);                       // 轴数字大小

        QColor radDisAxisColor = _comboBox_axisColor->currentColor();
        QString radDisAxisColorStr = GlobalHelperInstance->convertIntListToQString(QList<int>{radDisAxisColor.red(), radDisAxisColor.green(), radDisAxisColor.blue()});
        int radDisAxisThickness = _comboBox_axisThickness->currentText().toInt();
        auto radDisValuePrecision = _SpinBox_valuePrecision->value();
        QColor radDisAxisDigitColor = _comboBox_axisDigitColor->currentColor();
        QString radDisAxisDigitColorStr = GlobalHelperInstance->convertIntListToQString(QList<int>{radDisAxisDigitColor.red(), radDisAxisDigitColor.green(), radDisAxisDigitColor.blue()});
        int radDisAxisDigitSize = _comboBox_axisDigitSize->currentText().toInt();

        auto _radiusAxisDisplay = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getRadiusAxisDisplay();
        _radiusAxisDisplay->m_axisColor = radDisAxisColor;
        _radiusAxisDisplay->m_axisThickness = radDisAxisThickness;
        _radiusAxisDisplay->m_valuePrecision = radDisValuePrecision;
        _radiusAxisDisplay->m_axisDigitColor = radDisAxisDigitColor;
        _radiusAxisDisplay->m_axisDigitSize = radDisAxisDigitSize;

        m_pyCode.append(QString("polarcoordmainsetting.saveUIData_radiusAxisDisplay('%1',%2,%3,'%4',%5)")
                            .arg(radDisAxisColorStr)
                            .arg(radDisAxisThickness)
                            .arg(radDisValuePrecision)
                            .arg(radDisAxisDigitColorStr)
                            .arg(radDisAxisDigitSize));
    }

    void PolarCoordinateGraphSettingDialog::saveUIData_radiusAxisRange()
    {
        auto _tableWidget = m_tableWidget_radiusAxisRange;
        int _rowCount = -1;
        auto _checkBox_isAutoRange = (QCheckBox*)_tableWidget->cellWidget(++_rowCount, 1);                         // 自动范围
        auto _doubleSpinBox_maxValue = (BaseWidget::DoubleSpinBox*)_tableWidget->cellWidget(++_rowCount, 1);       // 最大值
        auto _doubleSpinBox_minValue = (BaseWidget::DoubleSpinBox*)_tableWidget->cellWidget(++_rowCount, 1);       // 最小值
        auto _checkBox_isAutoStepSize = (QCheckBox*)_tableWidget->cellWidget(++_rowCount, 1);                      // 自动步长
        auto _doubleSpinBox_customStepSize = (BaseWidget::DoubleSpinBox*)_tableWidget->cellWidget(++_rowCount, 1); // 自定义步长
        bool radRangIsAutoRange = _checkBox_isAutoRange->isChecked();
        double radRangMaxValue = _doubleSpinBox_maxValue->value();
        double radRangMinValue = _doubleSpinBox_minValue->value();

		auto _radRangMaxValue = qMax(radRangMaxValue, radRangMinValue);
        auto _radRangMinValue = qMin(radRangMaxValue, radRangMinValue);
        if (_radRangMaxValue == _radRangMinValue)
        {
            IdaDialogMsg::showDialog(this, QString("最大值与最小值不得相等，请重新输入。"), EDialogMsg::Error, tr("赋值错误"));
            m_execSuccess = false;
            return;
        }

        bool radRangIsAutoStepSize = _checkBox_isAutoStepSize->isChecked();
        double radRangCustomStepSize = _doubleSpinBox_customStepSize->value();

        auto _radiusAxisRange = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getRadiusAxisRange();
        _radiusAxisRange->m_isAutoRange = radRangIsAutoRange;
        _radiusAxisRange->m_maxValue = _radRangMaxValue;
        _radiusAxisRange->m_minValue = _radRangMinValue;
        _radiusAxisRange->m_isAutoStepSize = radRangIsAutoStepSize;
        _radiusAxisRange->m_customStepSize = radRangCustomStepSize;

        m_pyCode.append(QString("polarcoordmainsetting.saveUIData_radiusAxisRange(%1,%2,%3,%4,%5)")
                            .arg(radRangIsAutoRange)
                            .arg(radRangMaxValue)
                            .arg(radRangMinValue)
                            .arg(radRangIsAutoStepSize)
                            .arg(radRangCustomStepSize));
    }

    void PolarCoordinateGraphSettingDialog::saveUIData_grid()
    {
        auto _tableWidget = m_tableWidget_grid;
        int _rowCount = -1;
        auto _checkBox_isMainGridLineDisplay = (QCheckBox*)_tableWidget->cellWidget(++_rowCount, 1);              // 是否圆网格线显示
        auto _comboBox_mainGridLineColor = (BaseWidget::EColorComboBox*)_tableWidget->cellWidget(++_rowCount, 1); // 圆网格线颜色
        auto _comboBox_mainGridLineStyle = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);                  // 圆网格线样式
        auto _comboBox_mainGridLineThickness = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);              // 圆网格线粗细

        bool gridIsMainGridLineDisplay = _checkBox_isMainGridLineDisplay->isChecked();
        QColor gridMainGridLineColor = _comboBox_mainGridLineColor->currentColor();
        QString gridMainGridLineColorStr = GlobalHelperInstance->convertIntListToQString(QList<int>{gridMainGridLineColor.red(), gridMainGridLineColor.green(), gridMainGridLineColor.blue()});
        int gridMainGridLineStyle = _comboBox_mainGridLineStyle->currentIndex();
        double gridMainGridLineThickness = _comboBox_mainGridLineThickness->currentText().toDouble();

        auto _grid = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getGrid();
        _grid->m_isMainGridLineDisplay = gridIsMainGridLineDisplay;
        _grid->m_mainGridLineColor = gridMainGridLineColor;
        _grid->m_mainGridLineStyle = gridMainGridLineStyle;
        _grid->m_mainGridLineThickness = gridMainGridLineThickness;

        m_pyCode.append(QString("polarcoordmainsetting.saveUIData_grid(%1,'%2',%3,%4)")
                            .arg(gridIsMainGridLineDisplay)
                            .arg(gridMainGridLineColorStr)
                            .arg(gridMainGridLineStyle)
                            .arg(gridMainGridLineThickness));
    }

    void PolarCoordinateGraphSettingDialog::saveUIData_title()
    {
        auto _tableWidget = m_tableWidget_title;
        int _rowCount = -1;
        auto _lineEdit_title = (QLineEdit*)_tableWidget->cellWidget(++_rowCount, 1);                           // 标题名
        auto _comboBox_titleFontColor = (BaseWidget::EColorComboBox*)_tableWidget->cellWidget(++_rowCount, 1); // 标题字体颜色
        auto _comboBox_titleFontSize = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);                   // 标题字体大小

        QString titleName = _lineEdit_title->text();
        QColor titleFontColor = _comboBox_titleFontColor->currentColor();
        QString titleFontColorStr = GlobalHelperInstance->convertIntListToQString(QList<int>{titleFontColor.red(), titleFontColor.green(), titleFontColor.blue()});
        int titleFontSize = _comboBox_titleFontSize->currentText().toInt();

        auto _title = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getTitle();
        _title->m_titleName = titleName;
        _title->m_titleFontColor = titleFontColor;
        _title->m_titleFontSize = titleFontSize;

        m_pyCode.append(QString("polarcoordmainsetting.saveUIData_title('%1','%2',%3)")
                            .arg(titleName)
                            .arg(titleFontColorStr)
                            .arg(titleFontSize));
    }

    void PolarCoordinateGraphSettingDialog::saveUIData_legend()
    {
        auto _tableWidget = m_tableWidget_legend;
        int _rowCount = -1;
        auto _comboBox_legendFontColor = (BaseWidget::EColorComboBox*)_tableWidget->cellWidget(++_rowCount, 1); // 图例字体颜色
        auto _comboBox_legendFontSize = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);                   // 图例字体大小
        auto _comboBox_legendLineColor = (BaseWidget::EColorComboBox*)_tableWidget->cellWidget(++_rowCount, 1); // 图例框线颜色
        auto _comboBox_legendLineThickness = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);              // 图例框线粗细

        QColor legendFontColor = _comboBox_legendFontColor->currentColor();
        QString legendFontColorStr = GlobalHelperInstance->convertIntListToQString(QList<int>{legendFontColor.red(), legendFontColor.green(), legendFontColor.blue()});
        int legendFontSize = _comboBox_legendFontSize->currentText().toInt();
        QColor legendLineColor = _comboBox_legendLineColor->currentColor();
        QString legendLineColorStr = GlobalHelperInstance->convertIntListToQString(QList<int>{legendLineColor.red(), legendLineColor.green(), legendLineColor.blue()});
        int legendLineThickness = _comboBox_legendLineThickness->currentText().toInt();

        auto _legend = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getLegend();
        _legend->m_legendFontColor = legendFontColor;
        _legend->m_legendFontSize = legendFontSize;
        _legend->m_legendLineColor = legendLineColor;
        _legend->m_legendLineThickness = legendLineThickness;

        m_pyCode.append(QString("polarcoordmainsetting.saveUIData_legend('%1',%2,'%3',%4)")
                            .arg(legendFontColorStr)
                            .arg(legendFontSize)
                            .arg(legendLineColorStr)
                            .arg(legendLineThickness));
    }

    void PolarCoordinateGraphSettingDialog::saveUIData_dataProperty()
    {
        auto _tableWidget = m_tableWidget_dataProperty;
        int _rowCount = -1;
        auto _lineEdit_resultDataName = (QLineEdit*)_tableWidget->cellWidget(++_rowCount, 1);                 // 结果数据名称
        auto _comboBox_dataLineColor = (BaseWidget::EColorComboBox*)_tableWidget->cellWidget(++_rowCount, 1); // 数据线颜色
        auto _comboBox_dataLineStyle = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);                  // 数据线样式
        auto _comboBox_dataLineThickness = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);              // 数据线粗细
        auto _checkBox_isDisplaySymbol = (QCheckBox*)_tableWidget->cellWidget(++_rowCount, 1);                // 是否显示符号
        auto _comboBox_symbolStyle = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);                    // 符号样式
        auto _comboBox_symbolSize = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);                     // 符号大小
        auto _comboBox_symbolColor = (BaseWidget::EColorComboBox*)_tableWidget->cellWidget(++_rowCount, 1);   // 符号颜色

        QString dataProResultDataName = _lineEdit_resultDataName->text();
        QColor dataProDataLineColor = _comboBox_dataLineColor->currentColor();
        QString dataProDataLineColorStr = GlobalHelperInstance->convertIntListToQString(QList<int>{dataProDataLineColor.red(), dataProDataLineColor.green(), dataProDataLineColor.blue()});
        int dataProDataLineStyle = _comboBox_dataLineStyle->currentIndex();
        double dataProDataLineThickness = _comboBox_dataLineThickness->currentText().toDouble();
        bool dataProIsDisplaySymbol = _checkBox_isDisplaySymbol->isChecked();
        int dataProSymbolStyle = _comboBox_symbolStyle->currentIndex();
        double dataProSymbolSize = _comboBox_symbolSize->currentText().toDouble();
        QColor dataProSymbolColor = _comboBox_symbolColor->currentColor();
        QString dataProSymbolColorStr = GlobalHelperInstance->convertIntListToQString(QList<int>{dataProSymbolColor.red(), dataProSymbolColor.green(), dataProSymbolColor.blue()});

        auto _dataProperty = m_polarCoordinateGraphCenterSettingData->m_style2D_DataProperty;
        if (_dataProperty == nullptr)
        {
            return;
        }
        _dataProperty->m_resultDataName = dataProResultDataName;
        _dataProperty->m_dataLineColor = dataProDataLineColor;
        _dataProperty->m_dataLineStyle = dataProDataLineStyle;
        _dataProperty->m_dataLineThickness = dataProDataLineThickness;
        _dataProperty->m_isDisplaySymbol = dataProIsDisplaySymbol;
        _dataProperty->m_symbolStyle = dataProSymbolStyle;
        _dataProperty->m_symbolSize = dataProSymbolSize;
        _dataProperty->m_symbolColor = dataProSymbolColor;

        m_pyCode.append(QString("polarcoordmainsetting.saveUIData_dataProperty('%1','%2',%3,%4,%5,%6,%7,'%8')")
                            .arg(dataProResultDataName)
                            .arg(dataProDataLineColorStr)
                            .arg(dataProDataLineStyle)
                            .arg(dataProDataLineThickness)
                            .arg(dataProIsDisplaySymbol)
                            .arg(dataProSymbolStyle)
                            .arg(dataProSymbolSize)
                            .arg(dataProSymbolColorStr));
    }

    void PolarCoordinateGraphSettingDialog::updateUIData_angleAxisDisplay()
    {
        auto _tableWidget = m_tableWidget_angleAxisDisplay;
        auto _angleAxisDisplay = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getAngleAxisDisplay();

        int _rowCount = -1;
        auto _comboBox_axisColor = (BaseWidget::EColorComboBox*)_tableWidget->cellWidget(++_rowCount, 1);          // 轴线颜色
        auto _comboBox_axisThickness = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);                       // 轴线粗细
        auto _SpinBox_valuePrecision = (QSpinBox*)_tableWidget->cellWidget(++_rowCount, 1); // 数值精度
        auto _comboBox_axisDigitColor = (BaseWidget::EColorComboBox*)_tableWidget->cellWidget(++_rowCount, 1);     // 轴数字颜色
        auto _comboBox_axisDigitSize = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);                       // 轴数字大小

        _comboBox_axisColor->setCurrentColor(_angleAxisDisplay->m_axisColor);
        _comboBox_axisThickness->setCurrentText(QString::number(_angleAxisDisplay->m_axisThickness));
        _SpinBox_valuePrecision->setValue(_angleAxisDisplay->m_valuePrecision);
        _comboBox_axisDigitColor->setCurrentColor(_angleAxisDisplay->m_axisDigitColor);
        _comboBox_axisDigitSize->setCurrentText(QString::number(_angleAxisDisplay->m_axisDigitSize));
    }

    void PolarCoordinateGraphSettingDialog::updateUIData_angleAxisRange()
    {
        auto _tableWidget = m_tableWidget_angleAxisRange;
        auto _angleAxisRange = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getAngleAxisRange();

        int _rowCount = -1;
        auto _checkBox_isAutoStepSize = (QCheckBox*)_tableWidget->cellWidget(++_rowCount, 1);                      // 自动步长
        auto _doubleSpinBox_customStepSize = (BaseWidget::DoubleSpinBox*)_tableWidget->cellWidget(++_rowCount, 1); // 自定义步长

        _checkBox_isAutoStepSize->setChecked(_angleAxisRange->m_isAutoStepSize);
        _doubleSpinBox_customStepSize->setValue(_angleAxisRange->m_customStepSize);
    }

    void PolarCoordinateGraphSettingDialog::updateUIData_radiusAxisDisplay()
    {
        auto _tableWidget = m_tableWidget_radiusAxisDisplay;
        auto _radiusAxisDisplay = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getRadiusAxisDisplay();

        int _rowCount = -1;
        auto _comboBox_axisColor = (BaseWidget::EColorComboBox*)_tableWidget->cellWidget(++_rowCount, 1);          // 轴线颜色
        auto _comboBox_axisThickness = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);                       // 轴线粗细
        auto _SpinBox_valuePrecision = (QSpinBox*)_tableWidget->cellWidget(++_rowCount, 1); // 数值精度
        auto _comboBox_axisDigitColor = (BaseWidget::EColorComboBox*)_tableWidget->cellWidget(++_rowCount, 1);     // 轴数字颜色
        auto _comboBox_axisDigitSize = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);                       // 轴数字大小

        _comboBox_axisColor->setCurrentColor(_radiusAxisDisplay->m_axisColor);
        _comboBox_axisThickness->setCurrentText(QString::number(_radiusAxisDisplay->m_axisThickness));
        _SpinBox_valuePrecision->setValue(_radiusAxisDisplay->m_valuePrecision);
        _comboBox_axisDigitColor->setCurrentColor(_radiusAxisDisplay->m_axisDigitColor);
        _comboBox_axisDigitSize->setCurrentText(QString::number(_radiusAxisDisplay->m_axisDigitSize));
    }

    void PolarCoordinateGraphSettingDialog::updateUIData_radiusAxisRange()
    {
        auto _tableWidget = m_tableWidget_radiusAxisRange;
        auto _radiusAxisRange = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getRadiusAxisRange();

        int _rowCount = -1;
        auto _checkBox_isAutoRange = (QCheckBox*)_tableWidget->cellWidget(++_rowCount, 1);                         // 自动范围
        auto _doubleSpinBox_maxValue = (BaseWidget::DoubleSpinBox*)_tableWidget->cellWidget(++_rowCount, 1);       // 最大值
        auto _doubleSpinBox_minValue = (BaseWidget::DoubleSpinBox*)_tableWidget->cellWidget(++_rowCount, 1);       // 最小值
        auto _checkBox_isAutoStepSize = (QCheckBox*)_tableWidget->cellWidget(++_rowCount, 1);                      // 自动步长
        auto _doubleSpinBox_customStepSize = (BaseWidget::DoubleSpinBox*)_tableWidget->cellWidget(++_rowCount, 1); // 自定义步长

        _checkBox_isAutoRange->setChecked(_radiusAxisRange->m_isAutoRange);
        _doubleSpinBox_maxValue->setValue(_radiusAxisRange->m_maxValue);
        _doubleSpinBox_minValue->setValue(_radiusAxisRange->m_minValue);
        _checkBox_isAutoStepSize->setChecked(_radiusAxisRange->m_isAutoStepSize);
        _doubleSpinBox_customStepSize->setValue(_radiusAxisRange->m_customStepSize);
    }

    void PolarCoordinateGraphSettingDialog::updateUIData_grid()
    {
        auto _tableWidget = m_tableWidget_grid;
        auto _grid = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getGrid();

        int _rowCount = -1;
        auto _checkBox_isMainGridLineDisplay = (QCheckBox*)_tableWidget->cellWidget(++_rowCount, 1);              // 是否圆网格线显示
        auto _comboBox_mainGridLineColor = (BaseWidget::EColorComboBox*)_tableWidget->cellWidget(++_rowCount, 1); // 圆网格线颜色
        auto _comboBox_mainGridLineStyle = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);                  // 圆网格线样式
        auto _comboBox_mainGridLineThickness = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);              // 圆网格线粗细

        _checkBox_isMainGridLineDisplay->setChecked(_grid->m_isMainGridLineDisplay);
        _comboBox_mainGridLineColor->setCurrentColor(_grid->m_mainGridLineColor);
        _comboBox_mainGridLineStyle->setCurrentIndex(_grid->m_mainGridLineStyle);
        _comboBox_mainGridLineThickness->setCurrentText(QString::number(_grid->m_mainGridLineThickness));
    }

    void PolarCoordinateGraphSettingDialog::updateUIData_title()
    {
        auto _tableWidget = m_tableWidget_title;
        auto _title = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getTitle();

        int _rowCount = -1;
        auto _lineEdit_title = (QLineEdit*)_tableWidget->cellWidget(++_rowCount, 1);                           // 标题名
        auto _comboBox_titleFontColor = (BaseWidget::EColorComboBox*)_tableWidget->cellWidget(++_rowCount, 1); // 标题字体颜色
        auto _comboBox_titleFontSize = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);                   // 标题字体大小

        _lineEdit_title->setText(_title->m_titleName);
        _comboBox_titleFontColor->setCurrentColor(_title->m_titleFontColor);
        _comboBox_titleFontSize->setCurrentText(QString::number(_title->m_titleFontSize));
    }

    void PolarCoordinateGraphSettingDialog::updateUIData_legend()
    {
        auto _tableWidget = m_tableWidget_legend;
        auto _legend = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getLegend();

        int _rowCount = -1;
        auto _comboBox_legendFontColor = (BaseWidget::EColorComboBox*)_tableWidget->cellWidget(++_rowCount, 1); // 图例字体颜色
        auto _comboBox_legendFontSize = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);                   // 图例字体大小
        auto _comboBox_legendLineColor = (BaseWidget::EColorComboBox*)_tableWidget->cellWidget(++_rowCount, 1); // 图例框线颜色
        auto _comboBox_legendLineThickness = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);              // 图例框线粗细

        _comboBox_legendFontColor->setCurrentColor(_legend->m_legendFontColor);                         // 图例字体颜色
        _comboBox_legendFontSize->setCurrentText(QString::number(_legend->m_legendFontSize));           // 图例字体大小
        _comboBox_legendLineColor->setCurrentColor(_legend->m_legendLineColor);                         // 图例框线颜色
        _comboBox_legendLineThickness->setCurrentText(QString::number(_legend->m_legendLineThickness)); // 图例框线粗细
    }

    void PolarCoordinateGraphSettingDialog::updateUIData_dataProperty()
    {
        auto _tableWidget = m_tableWidget_dataProperty;
        auto _dataProperty = m_polarCoordinateGraphCenterSettingData->m_style2D_DataProperty;
        if (_dataProperty == nullptr)
        {
            return;
        }

        int _rowCount = -1;
        auto _lineEdit_resultDataName = (QLineEdit*)_tableWidget->cellWidget(++_rowCount, 1);                 // 结果数据名称
        auto _comboBox_dataLineColor = (BaseWidget::EColorComboBox*)_tableWidget->cellWidget(++_rowCount, 1); // 数据线颜色
        auto _comboBox_dataLineStyle = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);                  // 数据线样式
        auto _comboBox_dataLineThickness = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);              // 数据线粗细
        auto _checkBox_isDisplaySymbol = (QCheckBox*)_tableWidget->cellWidget(++_rowCount, 1);                // 是否显示符号
        auto _comboBox_symbolStyle = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);                    // 符号样式
        auto _comboBox_symbolSize = (QComboBox*)_tableWidget->cellWidget(++_rowCount, 1);                     // 符号大小
        auto _comboBox_symbolColor = (BaseWidget::EColorComboBox*)_tableWidget->cellWidget(++_rowCount, 1);   // 符号颜色

        _lineEdit_resultDataName->setText(_dataProperty->m_resultDataName);                               // 结果数据名称
        _comboBox_dataLineColor->setCurrentColor(_dataProperty->m_dataLineColor);                         // 数据线颜色
        _comboBox_dataLineStyle->setCurrentIndex(_dataProperty->m_dataLineStyle);                         // 数据线样式
        _comboBox_dataLineThickness->setCurrentText(QString::number(_dataProperty->m_dataLineThickness)); // 数据线粗细
        _checkBox_isDisplaySymbol->setChecked(_dataProperty->m_isDisplaySymbol);                          // 是否显示符号
        _comboBox_symbolStyle->setCurrentIndex(_dataProperty->m_symbolStyle);                             // 符号样式
        _comboBox_symbolSize->setCurrentText(QString::number(_dataProperty->m_symbolSize));               // 符号大小
        _comboBox_symbolColor->setCurrentColor(_dataProperty->m_symbolColor);                             // 符号颜色
    }

    // void PolarCoordinateGraphSettingDialog::pySaveUIData_angleAxisDisplay(QString angDisAxisColor, int angDisAxisThickness, double angDisValuePrecision, QString angDisAxisDigitColor, int angDisAxisDigitSize)
    // {
    //     auto _angleAxisDisplay = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getAngleAxisDisplay();
    //     auto colorList = GlobalHelperInstance->convertStringToIntList(angDisAxisColor);
    //     _angleAxisDisplay->m_axisColor = QColor(colorList[0], colorList[1], colorList[2]);
    //     _angleAxisDisplay->m_axisThickness = angDisAxisThickness;
    //     _angleAxisDisplay->m_valuePrecision = angDisValuePrecision;
    //     colorList = GlobalHelperInstance->convertStringToIntList(angDisAxisDigitColor);
    //     _angleAxisDisplay->m_axisDigitColor = QColor(colorList[0], colorList[1], colorList[2]);
    //     _angleAxisDisplay->m_axisDigitSize = angDisAxisDigitSize;
    // }

    // void PolarCoordinateGraphSettingDialog::pySaveUIData_angleAxisRange(bool angRangIsAutoStepSize, int angRangCustomStepSize)
    // {
    //     auto _angleAxisRange = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getAngleAxisRange();
    //     _angleAxisRange->m_isAutoStepSize = angRangIsAutoStepSize;
    //     _angleAxisRange->m_customStepSize = angRangCustomStepSize;
    // }

    // void PolarCoordinateGraphSettingDialog::pySaveUIData_radiusAxisDisplay(QString radDisAxisColor, int radDisAxisThickness, double radDisValuePrecision, QString radDisAxisDigitColor, int radDisAxisDigitSize)
    // {
    //     auto _radiusAxisDisplay = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getRadiusAxisDisplay();
    //     auto colorList = GlobalHelperInstance->convertStringToIntList(radDisAxisColor);
    //     _radiusAxisDisplay->m_axisColor = QColor(colorList[0], colorList[1], colorList[2]);
    //     _radiusAxisDisplay->m_axisThickness = radDisAxisThickness;
    //     _radiusAxisDisplay->m_valuePrecision = radDisValuePrecision;
    //     colorList = GlobalHelperInstance->convertStringToIntList(radDisAxisDigitColor);
    //     _radiusAxisDisplay->m_axisDigitColor = QColor(colorList[0], colorList[1], colorList[2]);
    //     _radiusAxisDisplay->m_axisDigitSize = radDisAxisDigitSize;
    // }

    // void PolarCoordinateGraphSettingDialog::pySaveUIData_radiusAxisRange(bool radRangIsAutoRange, double radRangMaxValue, double radRangMinValue, bool radRangIsAutoStepSize, double radRangCustomStepSize)
    // {
    //     auto _radiusAxisRange = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getRadiusAxisRange();
    //     _radiusAxisRange->m_isAutoRange = radRangIsAutoRange;
    //     _radiusAxisRange->m_maxValue = radRangMaxValue;
    //     _radiusAxisRange->m_minValue = radRangMinValue;
    //     _radiusAxisRange->m_isAutoStepSize = radRangIsAutoStepSize;
    //     _radiusAxisRange->m_customStepSize = radRangCustomStepSize;
    // }

    // void PolarCoordinateGraphSettingDialog::pySaveUIData_grid(bool gridIsMainGridLineDisplay, QString gridMainGridLineColor, int gridMainGridLineStyle, double gridMainGridLineThickness)
    // {
    //     auto _grid = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getGrid();
    //     _grid->m_isMainGridLineDisplay = gridIsMainGridLineDisplay;
    //     auto colorList = GlobalHelperInstance->convertStringToIntList(gridMainGridLineColor);
    //     _grid->m_mainGridLineColor = QColor(colorList[0], colorList[1], colorList[2]);
    //     _grid->m_mainGridLineStyle = gridMainGridLineStyle;
    //     _grid->m_mainGridLineThickness = gridMainGridLineThickness;
    // }

    // void PolarCoordinateGraphSettingDialog::pySaveUIData_title(QString titleName, QString titleFontColor, int titleFontSize)
    // {
    //     auto _title = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getTitle();
    //     _title->m_titleName = titleName;
    //     auto colorList = GlobalHelperInstance->convertStringToIntList(titleFontColor);
    //     _title->m_titleFontColor = QColor(colorList[0], colorList[1], colorList[2]);
    //     _title->m_titleFontSize = titleFontSize;
    // }

    // void PolarCoordinateGraphSettingDialog::pySaveUIData_legend(QString legendFontColor, int legendFontSize, QString legendLineColor, int legendLineThickness)
    // {
    //     auto _legend = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getLegend();
    //     auto colorList = GlobalHelperInstance->convertStringToIntList(legendFontColor);
    //     _legend->m_legendFontColor = QColor(colorList[0], colorList[1], colorList[2]);
    //     _legend->m_legendFontSize = legendFontSize;
    //     colorList = GlobalHelperInstance->convertStringToIntList(legendLineColor);
    //     _legend->m_legendLineColor = QColor(colorList[0], colorList[1], colorList[2]);
    //     _legend->m_legendLineThickness = legendLineThickness;
    // }

    // void PolarCoordinateGraphSettingDialog::pySaveUIData_dataProperty(QString dataProResultDataName, QString dataProDataLineColor, int dataProDataLineStyle, double dataProDataLineThickness, bool dataProIsDisplaySymbol, int dataProSymbolStyle, double dataProSymbolSize, QString dataProSymbolColor)
    // {
    //     auto _dataProperty = m_polarCoordinateGraphCenterSettingData->m_polarCoordinateSettingData->getDataProperty();
    //     _dataProperty->m_resultDataName = dataProResultDataName;
    //     auto colorList = GlobalHelperInstance->convertStringToIntList(dataProDataLineColor);
    //     _dataProperty->m_dataLineColor = QColor(colorList[0], colorList[1], colorList[2]);
    //     _dataProperty->m_dataLineStyle = dataProDataLineStyle;
    //     _dataProperty->m_dataLineThickness = dataProDataLineThickness;
    //     _dataProperty->m_isDisplaySymbol = dataProIsDisplaySymbol;
    //     _dataProperty->m_symbolStyle = dataProSymbolStyle;
    //     _dataProperty->m_symbolSize = dataProSymbolSize;
    //     colorList = GlobalHelperInstance->convertStringToIntList(dataProSymbolColor);
    //     _dataProperty->m_symbolColor = QColor(colorList[0], colorList[1], colorList[2]);
    // }

} // namespace pst
